from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate, SystemMessagePromptTemplate, HumanMessagePromptTemplate

from models import get_ds_model_client

prompt = ChatPromptTemplate.from_messages([SystemMessagePromptTemplate.from_template("请将一下内容翻译成{language}"),
                                             HumanMessagePromptTemplate.from_template("{text}")])
client = get_ds_model_client()
parse = StrOutputParser()

chain = prompt | client | parse
print(chain.invoke({"text": "I love programming.", "language": "中文"}))
